package xhwl.insurance.http.api;

import com.google.gson.Gson;

import okhttp3.RequestBody;
import rx.Observable;
import xhwl.insurance.http.ApiService;
import xhwl.retrofitrx.BaseApi;

/**
 * Created by admin on 2017/6/6.
 */

public class UpdateSaleInfoApi extends BaseApi {

    UpdateSaleInfoReq req;

    public UpdateSaleInfoApi(String c_type,String sx_id,String buy_id, String person_name,String sale_type, String person_mobile,
                             String person_idcard, String person_sex, String person_age,
                             String card_front, String card_back, String card_number,
                             String card_number_pic) {

        req =new UpdateSaleInfoReq(c_type,sx_id,buy_id,person_name,sale_type,person_mobile,
                person_idcard,person_sex,person_age,
                card_front,card_back,card_number,card_number_pic
                );
        setCancle(false);
    }

    @Override
    protected Observable getObservable() {
        RequestBody requestBody = RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), new Gson().toJson(req));
        return retrofit.create(ApiService.class).updateSaleInfo(requestBody);
    }

    public class UpdateSaleInfoReq {
        private String buy_id;
        private String person_name;
        private String person_mobile;
        private String person_idcard;
        private String person_sex;
        private String person_age;
        private String card_front;//身份证正面
        private String card_back;//身份证反面
        private String card_number;//卡号
        private String card_number_pic;//卡号的照片
        private String sx_id;
        private String c_type;
        private String sale_type;
        public UpdateSaleInfoReq(String c_type,String sx_id,String buy_id, String person_name, String sale_type,String person_mobile, String person_idcard, String person_sex, String person_age, String card_front, String card_back, String card_number, String card_number_pic) {
            this.c_type=c_type;
            this.sx_id=sx_id;
            this.buy_id = buy_id;
            this.person_name = person_name;
            this.sale_type = sale_type;
            this.person_mobile = person_mobile;
            this.person_idcard = person_idcard;
            this.person_sex = person_sex;
            this.person_age = person_age;
            this.card_front = card_front;
            this.card_back = card_back;
            this.card_number = card_number;
            this.card_number_pic = card_number_pic;
        }
    }
}
